package com.example.gsnd21study.web;

import com.example.gsnd21study.entity.DRO.RoleAndUser;
import com.example.gsnd21study.service.RoleService;
import com.example.gsnd21study.utils.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/role")
@RequiredArgsConstructor
public class RoleController {

    private final RoleService roleService;

    @GetMapping("/andUser/{roleId}")
    public Result<RoleAndUser> role(@PathVariable Long roleId) {
        RoleAndUser roleAndUser = roleService.findRoleAndUserByRoleId(roleId);
        return Result.success(roleAndUser);
    }

}
